package test;
import static org.junit.Assert.*; 

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import expression.InfixtoPostfixTranslator;

public class JohnCostantinoIPTest {
	@Before
	public void setUp() throws Exception
	{	
		
	}
	
	@After
	public void tearDown() throws Exception
	{
		
	}
	
	@Test
	public void InfixToPrefixTestOne() throws Exception
	{
		String answer = InfixtoPostfixTranslator.eval("2 * 3 + 6 / 2");
		assertTrue(answer.equals("2 3 * 6 2 / +"));
	}
	@Test
	public void InfixToPrefixTestTwo() throws Exception
	{
		String answer = InfixtoPostfixTranslator.eval("8 / 2 + 7 * 2 - 4");
		assertTrue(answer.equals("8 2 / 7 2 * + 4 -"));
	}
	@Test
	public void InfixToPrefixTestThree() throws Exception
	{
		String answer = InfixtoPostfixTranslator.eval("1 * 2 + 3");
		assertTrue(answer.equals("1 2 * 3 +"));
	}
	@Test
	public void InfixToPrefixTestFour() throws Exception
	{
		String answer = InfixtoPostfixTranslator.eval("( 1 + 2 ) * 3 ^ ( 4 / 5 ) / 6");
		assertTrue(answer.equals("1 2 + 3 4 5 / ^ * 6 /"));
	}
	@Test
	public void InfixToPrefixTestFive() throws Exception
	{
		String answer = InfixtoPostfixTranslator.eval("1 + 2 * 3 ^ 4 / 5 / 6");
		assertTrue(answer.equals("1 2 3 4 ^ * 5 / 6 / +"));
	}
}
